package com.heima.wemedia.thread;

import com.heima.model.wemedia.pojos.WmUser;

//通过threadLocal将进入网关拦截器中的请求头的userId传入controller
public class UserThreadLocal {

    //ThreadLocal类型的静态变量
    private static ThreadLocal<WmUser> threadLocal = new ThreadLocal<>();

    //set,get方法
    public static WmUser get() {
        return threadLocal.get();
    }

    public static void set(WmUser wmUser ) {
        threadLocal.set(wmUser);
    }

    //remove方法
    public static void remove(){
        threadLocal.remove();
    }
}
